<?php

namespace App\Http\Controllers;

use App\Common\FilterRepeatedComment;
use Illuminate\Http\Request;

class BloomFilterController extends Controller
{
    public function testBloom(Request $request)
    {
        $aa = $this->test([1,2,3,4]);
        dd($aa);
        $bloom = new FilterRepeatedComment();

        dd($bloom->add('wsabc'));
        dd($bloom->exists('ws'));
        dd($bloom->add('ws'));
        dd($bloom->add('love'));
    }

    public function test($array = [])
    {
        return function () use($array){
            $res = array_reduce($array,function($carry,$item) {
                return $carry + $item;
            },0);

            return $res;
        };
    }
}
